#ifndef CHANGEPASSWORDDIALOG_H
#define CHANGEPASSWORDDIALOG_H

#include <QDialog>
#include <QSqlRecord>

namespace Ui {
class ChangePasswordDialog;
}

class ChangePasswordDialog : public QDialog
{
    Q_OBJECT

public:
    explicit ChangePasswordDialog(QWidget *parent = nullptr, const QSqlRecord &userRecord = QSqlRecord());
    ~ChangePasswordDialog();

    QString getOldPassword() const;
    QString getNewPassword() const;
    bool isPasswordChanged() const;
    void setUserInfo(const QString &username, const QString &userID);

protected slots:
    void onPasswordTextChanged();
    void validateInputs();

public slots:
    void accept() override;

private:
    Ui::ChangePasswordDialog *ui;
    QString m_oldPassword;
    QString m_newPassword;
    bool m_passwordChanged;

    int calculatePasswordStrength(const QString &password);
    bool validatePasswordRules(const QString &password);
};

#endif // CHANGEPASSWORDDIALOG_H
